import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Manage',
    component:()=> import('../views/Manage.vue'),
    redirect:"/home",
    children: [
      {path: 'user', name: 'User', component:()=> import('../views/User.vue')},
      {path: 'home', name: 'Home', component:()=> import('../views/Home.vue')},
      {path: 'onlinechat', name: 'OnlineChat', component:()=> import('../views/OnlineChat.vue')},
      {path: 'about', name: 'About', component:()=> import('../views/AboutView.vue')}
      ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  }
]

const router = new VueRouter({
  //防止刷新404
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router
